#!/bin/sh
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
ROOT_DIR=`cd $(dirname $0)/..; pwd`

EXEFILE=`which varnishd`
PIDFILE=$ROOT_DIR/bin/varnishd.pid
if [ -e $PIDFILE ]; then
	PID=`cat $PIDFILE` 
	if [ /proc/$PID/exe -ef $EXEFILE ]; then
		echo 'kill varnishd'
		kill $PID
	fi
fi

EXEFILE=`which varnishncsa`
PIDFILE=$ROOT_DIR/bin/varnishncsa.pid
if [ -e $PIDFILE ]; then
	PID=`cat $PIDFILE` 
	if [ /proc/$PID/exe -ef $EXEFILE ]; then
		echo 'kill varnishncsa'
		kill $PID
	fi
fi

